package ScreensManager.ProjectScreen
{
	import Levels.Level;
	import ScreensManager.Screen;
	import ScreensManager.ScreenManager;
	import flash.events.KeyboardEvent;
	import flash.ui.Keyboard;
	/**
	 * ...
	 * @author Thiago
	 */
	public class GameScreen extends Screen
	{
		/*Variaveis da classe
		 * 
		 */
		public static var level1:Level;
		
		public function GameScreen(main:Main) 
		{
			
			/*
			 * Instanciacao de variaveis
			 */
			level1 = new Level();
			level1.setLevel(main);
			
			//Pause Function Event
			Main.getInstance().stage.addEventListener(KeyboardEvent.KEY_DOWN, pauseKeyOn, false, 0, true)
		}
		
		override public function removeListeners():void 
		{
			Main.getInstance().stage.removeEventListener(KeyboardEvent.KEY_DOWN, pauseKeyOn);
		}
		
			//Pause Function
		public function pauseKeyOn(e:KeyboardEvent)
		{
			if (e.keyCode == Keyboard.SPACE)
			{
				trace(level1.isPaused());
				if (!level1.isPaused())
				{
					level1.pauseButton();
				}
				else
				{
					level1.resumeLevel();
				}
			}
		}
		
		override public function update():void 
		{
			level1.update();
		}
		
		override public function drawScreen():void 
		{
			// Adiciono o heroi NESTA tela
			
			super.drawScreen();
			this.addChild(level1);
			
		}
		
	}

}